**# Bookmark #1 Setting

*Windows
global root  = "G:/Dropbox/Environmental Injustice/Empirical"
global rawdata = "$root/rawdata"
global workdata = "$root/workdata"
global results = "$root/results"
global outfile = "$root/outfile"

cd "$workdata"

**# Bookmark #2 
use "$outfile/Individual_heartandday.dta",clear
merge 1:1 IDind hhid line age wave using "$outfile/Individual_tumor.dta",gen(m1)
keep if m1==3

swindex heart day tumor,gen(swindex)

foreach i in 2000 2004 2006 2009 2011{
gen year`i'=(year==`i')
gen lowedu5_notapwater_Year`i'=lowedu5*notapwater*year`i'
}
	
reghdfe swindex lowedu5_notapwater_Year2000 o.lowedu5_notapwater_Year2004 lowedu5_notapwater_Year2006 lowedu5_notapwater_Year2009 lowedu5_notapwater_Year2011 lowedu5_post lowedu5_notapwater notapwater_post lowedu5 notapwater post ,absorb(i.id i.province#i.year) cluster(i.province i.year)
est store swindex


coefplot swindex, keep(lowedu5_notapwater_*) levels(95) omitted vertical ///
    xlabel(1 "2000" 2 "2004" 3 "2006" 4 "2009" 5 "2011", ///
	labcolor(black)) ///
    recast(connected) lcolor(navy) lpattern(solid) lwidth(medthick) ///
    ciopts(recast(rcap) lcolor(%50) lwidth(thin)) ///
    mlcolor(navy) mfcolor(white) msize(medium) msymbol(oh) ///
    yline(0, lcolor(gs10) lwidth(thin)) ///
    xline(2, lcolor(gs10) lpattern(dash)) ///
    ytitle("Coefficient") ///
	ylabel(-0.2(0.2)0.6, nogrid) ///
	xtitle("(A) Health Index",size(large) margin(l-10 t+4 b-4)) ///
    graphregion(lcolor(white) color(white)) ///
    plotregion(margin(zero) color(white)) 

graph export "$results/Fig. S6(A).pdf", as(pdf) name("Graph") replace


**# Bookmark #4
use "$outfile/Individual_wage.dta",clear

foreach i in 1999 2003 2005 2008 2010{
gen year`i'=(year==`i')
gen lowedu5_notapwater_Year`i'=lowedu5*notapwater*year`i'
}
	
reghdfe wage_100 lowedu5_notapwater_Year1999 lowedu5_notapwater_Year2003 o.lowedu5_notapwater_Year2005 lowedu5_notapwater_Year2008 lowedu5_notapwater_Year2010 lowedu5_post lowedu5_notapwater notapwater_post lowedu5 notapwater post ,absorb(i.id i.province#i.year) cluster(i.province i.year)
est store wage_100

coefplot wage_100, keep(lowedu5_notapwater_*) levels(95) omitted vertical ///
    xlabel(1 "1999" 2 "2003" 3 "2005" 4 "2008" 5 "2010", ///
	labcolor(black)) ///
    recast(connected) lcolor(navy) lpattern(solid) lwidth(medthick) ///
    ciopts(recast(rcap) lcolor(%50) lwidth(thin)) ///
    mlcolor(navy) mfcolor(white) msize(medium) msymbol(oh) ///
    yline(0, lcolor(gs10) lwidth(thin)) ///
    xline(3, lcolor(gs10) lpattern(dash)) ///
    ytitle("Coefficient") ///
	ylabel(-25(5)10, nogrid) ///
	xtitle("(B) Wage Percentile",size(large) margin(l-10 t+4 b-4)) ///
    graphregion(lcolor(white) color(white)) ///
    plotregion(margin(zero) color(white)) 

	graph export "$results/Fig. S6(B).pdf", as(pdf) name("Graph") replace
